import { QXEvent } from "qx-util";
import { IParam, GridExpBarActionType, IGridExpBarAbility, IGridExpBarControllerParams, IGridExpBarStore, GridExpBarController, ICtrlEvent, IGridExpBarController, IGridExpBarModel } from "@/core";
import { useGridExpBarAction, useGridExpBarBasic, useGridExpBarControllerParams, useGridExpBarProps } from "@/hooks/widget/use-grid-exp-bar";
import { model } from "./grid-exp-viewgridexpbar-grid-exp-bar-model";
// 基于template/src/widgets/{{appEntities}}/{{ctrls@GRIDEXPBAR}}-grid-exp-bar/{{spinalCase ctrl.codeName}}-grid-exp-bar-hook.ts.hbs生成
/**
 * 获取输入参数
 *
 * @export
 * @return {*}
 */
export function useProps() {
	return {
		...useGridExpBarProps(),
	};
}

/**
 * 获取基础数据
 *
 * @export
 * @param {*} props
 * @return {*}
 */
export function useBasic(props: any) {
	return {
		...useGridExpBarBasic(model, props),
	};
}

/**
 * 获取行为
 *
 * @export
 */
export function useAction(controller: any) {
	return {
		...useGridExpBarAction(controller),
	};
}

/**
 * 获取控制器
 *
 * @export
 * @param {IParam} props
 * @param {QXEvent<ICtrlEvent<GridExpBarActionType, IGridExpBarAbility>>} evt
 * @return {*}
 */
export function useController(
	props: IParam,
	evt: QXEvent<ICtrlEvent<GridExpBarActionType, IGridExpBarAbility>>,
    otherParams: IParam = {},
): IGridExpBarController<IGridExpBarStore, IGridExpBarAbility> {
	const params: IGridExpBarControllerParams<GridExpBarActionType, IGridExpBarAbility> =
		useGridExpBarControllerParams<IGridExpBarStore, IGridExpBarModel>(model, props, evt, otherParams);
  	return new GridExpBarController(params);
}